% dataxxx = output.residuals(100:500);
% datarrr = repmat(datarr,10,1);

% [peak,index]=findpeaks(output2.residuals)
% hold on;
% plot(index,peak,'rv','MarkerFaceColor','r'); 
% for i=1:length(index)
%     datarrrr(index(i)) = datarrrr(index(i)) + 0.5*rand;
% end

% datam = smooth(txx,datarrrr,0.5,'rloess');
% start = 1833;
% long  = 3000;

start = 8;
long  = 1999;
% x1 = filtered_datax(start:start+long);
x1 = output.residuals(start:start+long);
tx1 = t(1:length(x1));

FUN_plotDataDCTFreq(FigureStart-2,x1);
% x2 = smooth(tx1,x1,0.05,'rloess')';
% x3 = (output1.residuals)';
% tx3 = t(1:length(x3));
% x4 = smooth(tx3,x3,0.0125,'rloess')';
% x4 = repmat(x3,10,1);
% x5 = x4(1:2000);
% tx5 = t(1:length(x5));
% tx6 = output4.residuals(168:2200);tx6 = flix(tx6);


% figure_FontSize=12;
% figure(14);hold on
% axis([0 10 -500 100]);
% set(get(gca,'XLabel'),'FontSize',figure_FontSize);
% set(get(gca,'YLabel'),'FontSize',figure_FontSize);
% legend( 'Magnitude','Phase');

% hsin2 = dsp.SineWave;
%  hsin2.Frequency = 10;
%  hsin2.PhaseOffset = [0 pi/2];
%  hsin2.SamplesPerFrame = 1000;
%  y = step(hsin2);
%  plot(y);


% x = 0:.01:5;
% y=2*exp(-0.5*x).*sin(2*pi*x);
% f1 = 2*exp(-0.5*x);
% f2 = -2*exp(-0.5*x);
% plot(x,y,x,f1,':r',x,f2,':r')

% envelop max detection
% len = 4;
% dct_abs = abs(dct(ppg_data));
% y = reshape(dct_abs,len,length(dct_abs)/len);
% [y,x]=max(y);
% x1=f(1:len:length(dct_abs));
% x2=x1+x*f(1);
% plot(f/2,dct_abs,'b',x2/2,y,'r-');


